--- title: "3、好数" created: 2025-11-28 tags: - 算法 --- # 3、好数 ## 题目 好数 ![[image-751555de.png]] ## 思路分析 老朋友了 拆数分解 因为是考试所以每步都在调试 这里其实没必要 谨慎过头了 ## 代码实现 ```cpp #include using namespace std; #define endl '\n' typedef long long LL; //拆数分解 另外维护一个信息:当前的数是第几位 用个cnt计数 从1开始 int main() { int n;cin>>n; LL res=0; for(int i=1;i<=n;i++){ int x=i; int cnt=1;//从个位开始 // cout<<"当前数为:"<